home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 1 / ACE CD 1.iso / files / utils / acroarex.dms / in.adf / Support / CmdSHELL.acrx < prev    next >
Encoding:
Text File  |  1994-06-08  |  16.1 KB  |  511 lines

  1. /** $VER: CmdShell.acrx 1.0 (08 Jun 1994)
  2.  ** ArCo's
  3.  ** Original by David N. Junod
  4.  ** Modified by Bill Hawes
  5.  ** Modified by Michael Sewell
  6.  **/
  7.  
  8.  
  9. OPTIONS RESULTS
  10. OPTIONS FAILAT 100
  11. OPTIONS PROMPT "Cmd> "
  12.  
  13. ADDRESS ARCO
  14.   /* Display instructions */
  15. /*  SAY 'Enter commands, or press CTRL-\ to exit.' */
  16.  
  17.   /* Get input until the user closes the Command Shell */
  18.   DO FOREVER
  19.  
  20.     /* Wait until the user types a command followed by RETURN */
  21.     PARSE PULL cmdString
  22.  
  23.     SELECT
  24.       WHEN (cmdString = "") | (UPPER(cmdString) = "Q") | (UPPER(cmdString) = "ENDCLI") THEN do
  25.     LEAVE
  26.       END
  27.  
  28.       WHEN (cmdString = "?") | (UPPER(cmdString) = "HELP") THEN DO
  29.         SAY 'Enter "HELP <command>" to obtain a command''s template.'
  30.       END;
  31.  
  32.     WHEN (WORDS(cmdString) = "2") & (UPPER(WORD(cmdString,1)) = "HELP") THEN do
  33.         CALL help(cmdString)
  34.     END;
  35.  
  36.       OTHERWISE DO
  37.         CALL HandleCmd(cmdString)
  38.       END;
  39.  
  40.     END
  41.   END
  42.  
  43.   RETURN
  44.  
  45.  
  46. HandleCmd: PROCEDURE
  47. PARSE ARG cmdString
  48.  
  49.   /* Execute the command */
  50.   cmdString
  51.  
  52.   /* See if the command succeeded */
  53.   IF RC = 0 THEN do
  54.     IF symbol('RESULT') == "VAR" THEN DO
  55.       SAY RESULT
  56.     END
  57.     RETURN
  58.   END
  59.  
  60.   /* Wasn't an editor command, try running it as an ARexx script */
  61.   if RC > 0  THEN DO
  62.     ADDRESS REXX cmdString
  63.  
  64.     /* Wasn't an ARexx script, try running it as a CLI command */
  65.     IF RC > 0 THEN DO
  66.       ADDRESS COMMAND cmdString
  67.     END
  68.  
  69.   END;
  70.  
  71.   RETURN
  72. /* end of HandleCmd() */
  73.  
  74. help: PRODEDURE
  75. ARG one item
  76.  
  77.     SELECT
  78.         WHEN (item = "LOCK") THEN do
  79.             SAY item' grants you exclusive access to ArCos Arexx commands'
  80.             SAY 'TEMPLATE :    'item' '
  81.         END;
  82.  
  83.         WHEN (item = "UNLOCK") THEN do
  84.             SAY item' releases exclusive access to ArCos Arexx commands'
  85.             SAY 'TEMPLATE :    'item' '
  86.         END;
  87.  
  88.         WHEN (item = "QUIT") THEN do
  89.             SAY item' shuts down ArCo, if QUIT_REQUEST is FALSE, you will not be'
  90.             SAY 'prompted as to whether you wish to quit or not'
  91.             SAY 'TEMPLATE :    'item' '
  92.         END;
  93.  
  94.         WHEN (item = "LAUNCHMACRO") THEN do
  95.             SAY item' will launch another Arexx macro'
  96.             SAY 'TEMPLATE :    'item' <macro>'
  97.         END;
  98.  
  99.         WHEN (item = "SETSRCFILE") THEN do
  100.             SAY item' sets the ArCo source file to the argument supplied, if no'
  101.             SAY 'argument is supplied, A filerequestor will prompt the user'
  102.             SAY 'TEMPLATE :    'item' [file name]'
  103.         END;
  104.  
  105.         WHEN (item = "SETOBJFILE") THEN do
  106.             SAY item' sets the ArCo object file to the argument supplied, if no'
  107.             SAY 'argument is supplied, A filerequestor will prompt the user'
  108.             SAY 'TEMPLATE :    'item' [file name]'
  109.         END;
  110.  
  111.         WHEN (item = "SETEXECFILE") THEN do
  112.             SAY item' sets the ArCo executable file to the argument supplied, if no'
  113.             SAY 'argument is supplied, A filerequestor will prompt the user'
  114.             SAY 'TEMPLATE :    'item' [file name]'
  115.         END;
  116.  
  117.         WHEN (item = "SETSRCDIR") THEN do
  118.             SAY item' sets the ArCo source directory to the argument supplied.'
  119.             SAY 'TEMPLATE :    'item' <directory>'
  120.         END;
  121.  
  122.         WHEN (item = "SETOBJDIR") THEN do
  123.             SAY item' sets the ArCo object directory to the argument supplied.'
  124.             SAY 'TEMPLATE :    'item' <directory>'
  125.         END;
  126.  
  127.         WHEN (item = "SETEXECDIR") THEN do
  128.             SAY item' sets the ArCo executable directory to the argument supplied.'
  129.             SAY 'TEMPLATE :    'item' <directory>'
  130.         END;
  131.  
  132.         WHEN (item = "SETLIBDIR") THEN do
  133.             SAY item' sets the ArCo link library directory to the argument supplied.'
  134.             SAY 'TEMPLATE :    'item' <directory>'
  135.         END;
  136.  
  137.         WHEN (item = "SETREADER") THEN do
  138.             SAY item' determines the default tool to Read the src file or script output'
  139.             SAY 'TEMPLATE :    'item' <tool>'
  140.         END;
  141.  
  142.         WHEN (item = "SETEDITOR") THEN do
  143.             SAY item' determines the default tool to Edit the src file or script output'
  144.             SAY 'TEMPLATE :    'item' <tool>'
  145.         END;
  146.  
  147.         WHEN (item = "ICONIFY") THEN do
  148.             SAY item' switches ArCo to an Iconified state.'
  149.             SAY 'TEMPLATE :    'item' '
  150.         END;
  151.  
  152.         WHEN (item = "OPENGUI") THEN do
  153.             SAY item' switches ArCo to the main interface panel.'
  154.             SAY 'TEMPLATE :    'item' '
  155.         END;
  156.  
  157.         WHEN (item = "REXXONLY") THEN do
  158.             SAY item' closes all visible signs of ArCo, acces can only be through'
  159.             SAY 'the Arexx port, which is names ARCO.'
  160.             SAY 'TEMPLATE :    'item' '
  161.         END;
  162.  
  163.         WHEN (item = "TELL") THEN do
  164.             SAY item' will pass on information to the user, but ONLY if the verbose'
  165.             SAY 'variable has been set to TRUE. '
  166.             SAY 'TEMPLATE :    'item' <string>'
  167.         END;
  168.  
  169.         WHEN (item = "SHOUT") THEN do
  170.             SAY item' will inform the user and does not use the verbose variable'
  171.             SAY 'Used for error reporting etc.'
  172.             SAY 'TEMPLATE :    'item' <string>'
  173.         END;
  174.  
  175.         WHEN (item = "REQUEST") THEN do
  176.             SAY item' will pass on information to the uservia a system requestor'
  177.             SAY 'Used for urgent error messages that may be overlooked if put through'
  178.             SAY 'the ArCo stasis window'
  179.             SAY 'TEMPLATE :    'item' <string>'
  180.         END;
  181.  
  182.         WHEN (item = "VERSION") THEN do
  183.             SAY item' sets the ArCo variable 'item', Causing the insertion of a version'
  184.             SAY 'string in to the compiled file,'
  185.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  186.             SAY 'TEMPLATE :    'item' [BOOL]'
  187.         END;
  188.  
  189.         WHEN (item = "VERBOSE") THEN do
  190.             SAY item' sets the ArCo variable 'item', allowing the reporting of all'
  191.             SAY 'actions in the ArCo stasis window'
  192.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  193.             SAY 'TEMPLATE :    'item' [BOOL]'
  194.         END;
  195.  
  196.         WHEN (item = "RUN") THEN do
  197.             SAY 'When set, ArCo will run the executable after compilation'
  198.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  199.             SAY 'TEMPLATE :    'item' [BOOL]'
  200.         END;
  201.  
  202.         WHEN (item = "WRITEICON") THEN do
  203.             SAY 'When set, ArCo will Write out icons for ALL file output.'
  204.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  205.             SAY 'TEMPLATE :    'item' [BOOL]'
  206.         END;
  207.  
  208.         WHEN (item = "ADDLINKLIB") THEN do
  209.             SAY item' will add the given link libraries to the list of libraries'
  210.             SAY 'to be searched during compilation.'
  211.             SAY 'TEMPLATE :    'item' <linklib1> [linklib2] [linklib3]...[linklib15]'
  212.         END;
  213.  
  214.         WHEN (item = "GETLINKLIB") THEN do
  215.             SAY item' will allow the user to choose a link library via an ASL file'
  216.             SAY 'requestor'
  217.             SAY 'TEMPLATE :    'item' '
  218.         END;
  219.  
  220.         WHEN (item = "REMLINKLIB") THEN do
  221.             SAY item' will remove the given link libraries from the list of libraries'
  222.             SAY 'to be searched during compilation.'
  223.             SAY 'TEMPLATE :    'item' <linklib1> [linklib2] [linklib3]...[linklib15]'
  224.         END;
  225.  
  226.         WHEN (item = "RESETLIBLIST") THEN do
  227.             SAY item' will remove all link libraries from the list, freeing memory'
  228.             SAY 'and re-initialising the list.'
  229.             SAY 'TEMPLATE :    'item' '
  230.         END;
  231.  
  232.         WHEN (item = "SETAUTHOR") THEN do
  233.             SAY item' determines the author string that is inserted in compiled'
  234.             SAY 'scripts and also forms part of the version string'
  235.             SAY 'do NOT use any puntuation marks,'
  236.             SAY 'TEMPLATE :    'item' <name string>'
  237.         END;
  238.  
  239.         WHEN (item = "LOADPREFS") THEN do
  240.             SAY item' will cause ArCo to load the prefs file supplied as an argument,'
  241.             SAY 'if no argument is supplied, A filerequestor will prompt the user'
  242.             SAY 'TEMPLATE :    'item' [prefsfile]'
  243.         END;
  244.  
  245.         WHEN (item = "SAVEPREFS") THEN do
  246.             SAY item' will cause ArCo to save the preferences to the default prefs'
  247.             SAY 'file which is set in ArCo''s tool types.'
  248.             SAY 'TEMPLATE :    'item' '
  249.         END;
  250.  
  251.         WHEN (item = "SAVEPREFSAS") THEN do
  252.             SAY item' will cause ArCo to save the preferences to a file supplied as'
  253.             SAY 'an argument,A filerequestor is supplied if there is no argument.'
  254.             SAY 'TEMPLATE :    'item' [prefsfile]'
  255.         END;
  256.  
  257.         WHEN (item = "SETOUTPUT") THEN do
  258.             SAY item' denotes the filetype that is produced by ArCo, Choice of 4'
  259.             SAY 'EXECUTABLE, LIBRARYOBJECT, LINKOBJECT & SCRIPT, if no argument is'
  260.             SAY 'supplied, defaults to EXECUTABLE.'
  261.             SAY 'TEMPLATE :    'item' [filetype]'
  262.         END;
  263.  
  264.         WHEN (item = "SETDESTLIB") THEN do
  265.             SAY item' will set the destination link library that the compiled'
  266.             SAY 'object file will be added to, ONLY OF USE IF OUTPUT TYPE IS'
  267.             SAY 'SET TO LIBRARY OBJECT'
  268.             SAY 'TEMPLATE :    'item' <linklibrary>'
  269.         END;
  270.  
  271.         WHEN (item = "COMPILE") THEN do
  272.             SAY item' sets the compilation process in motion, if an argument is'
  273.             SAY 'supplied, Then this is compiled instead of anything that may'
  274.             SAY 'already be set as the source file.'
  275.             SAY 'TEMPLATE :    'item' [source file]'
  276.         END;
  277.  
  278.         WHEN (item = "GETINTERRUPTS") THEN do
  279.             SAY item' opens the interrupt requestor for the user to choose which'
  280.             SAY 'interrupts they wish to use.'
  281.             SAY 'TEMPLATE :    'item' '
  282.         END;
  283.  
  284.         WHEN (item = "GETTRACE") THEN do
  285.             SAY item' opens the trace requestor for the user to choose which'
  286.             SAY 'trace options they wish to use.'
  287.             SAY 'TEMPLATE :    'item' '
  288.         END;
  289.  
  290.         WHEN (item = "GETARGS") THEN do
  291.             SAY item' opens the arguments requestor for the user to choose which'
  292.             SAY 'arguments are to be passed to their compiled program when run'
  293.             SAY 'This will only open the requestor if RUN has already been set'
  294.             SAY 'TEMPLATE :    'item' '
  295.         END;
  296.  
  297.         WHEN (item = "SETENVIRONMENT") THEN do
  298.             SAY item' denotes which environment you wish to run your compiled'
  299.             SAY 'program in, Either Cli or WB, If no argument is passed, It'
  300.             SAY 'assumes WB.'
  301.             SAY 'TEMPLATE :    'item' [type]'
  302.         END;
  303.  
  304.         WHEN (item = "SETCLIARGS") THEN do
  305.             SAY item' denotes the arguments that are to be passed to the compiled'
  306.             SAY 'program when run in a CLI environment'
  307.             SAY 'TEMPLATE :    'item' <argument string>'
  308.         END;
  309.  
  310.         WHEN (item = "SETWBARGS") THEN do
  311.             SAY item' denotes the arguments that are to be passed to the compiled'
  312.             SAY 'program when run in a WB environment'
  313.             SAY 'TEMPLATE :    'item' <argument 1> [argument 2].......[argument 15]'
  314.         END;
  315.  
  316.         WHEN (item = "CLOSEARGSWINDOW") THEN do
  317.             SAY item' will close the argument requestor, but is only of use OUTSIDE'
  318.             SAY 'the script that called GETARGS as the script then waits for the'
  319.             SAY 'argument requestor to close before continuing.'
  320.             SAY 'TEMPLATE :    'item' '
  321.         END;
  322.  
  323.         WHEN (item = "RESETARGS") THEN do
  324.             SAY item' will clear the arguments back to thedefault values'
  325.             SAY 'TEMPLATE :    'item' '
  326.         END;
  327.  
  328.         WHEN (item = "CANCELARGS") THEN do
  329.             SAY item' will return the argument values to those that were SNAPPED'
  330.             SAY 'using the command SNAPARGS, If the requestor was opened by another'
  331.             SAY 'script, The values in use prior to the requestor will be used'
  332.             SAY 'TEMPLATE :    'item' '
  333.         END;
  334.  
  335.         WHEN (item = "SETTRACE") THEN do
  336.             SAY 'When set, will add the trace option in the compiled file'
  337.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  338.             SAY 'TEMPLATE :    'item' [BOOL]'
  339.         END;
  340.  
  341.         WHEN (item = "SETTR_ALL") THEN do
  342.             SAY 'When set, will add the trace all option in the compiled file'
  343.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  344.             SAY 'TEMPLATE :    'item' [BOOL]'
  345.         END;
  346.  
  347.         WHEN (item = "SETTR_COMMANDS") THEN do
  348.             SAY 'When set, will add the trace commands option in the compiled file'
  349.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  350.             SAY 'TEMPLATE :    'item' [BOOL]'
  351.         END;
  352.  
  353.         WHEN (item = "SETTR_ERRORS") THEN do
  354.             SAY 'When set, will add the trace errors option in the compiled file'
  355.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  356.             SAY 'TEMPLATE :    'item' [BOOL]'
  357.         END;
  358.  
  359.         WHEN (item = "SETTR_INTERM") THEN do
  360.             SAY 'When set, will add the trace intermediates option in the compiled file'
  361.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  362.             SAY 'TEMPLATE :    'item' [BOOL]'
  363.         END;
  364.  
  365.         WHEN (item = "SETTR_LABELS") THEN do
  366.             SAY 'When set, will add the trace labels option in the compiled file'
  367.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  368.             SAY 'TEMPLATE :    'item' [BOOL]'
  369.         END;
  370.  
  371.         WHEN (item = "SETTR_NORMAL") THEN do
  372.             SAY 'When set, will add the trace normal option in the compiled file'
  373.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  374.             SAY 'TEMPLATE :    'item' [BOOL]'
  375.         END;
  376.  
  377.         WHEN (item = "SETTR_RESULTS") THEN do
  378.             SAY 'When set, will add the trace results option in the compiled file'
  379.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  380.             SAY 'TEMPLATE :    'item' [BOOL]'
  381.         END;
  382.  
  383.         WHEN (item = "SETTR_SCAN") THEN do
  384.             SAY 'When set, will add the trace scan option in the compiled file'
  385.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  386.             SAY 'TEMPLATE :    'item' [BOOL]'
  387.         END;
  388.  
  389.         WHEN (item = "SETTR_INTERACTIVE") THEN do
  390.             SAY 'When set, will add the trace interactive option in the compiled file'
  391.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  392.             SAY 'TEMPLATE :    'item' [BOOL]'
  393.         END;
  394.  
  395.         WHEN (item = "SETINTERRUPT") THEN do
  396.             SAY 'When set, will add the interrupt option in the compiled file'
  397.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  398.             SAY 'TEMPLATE :    'item' [BOOL]'
  399.         END;
  400.  
  401.         WHEN (item = "SETSIG_BRKC") THEN do
  402.             SAY 'When set, will add the interrupt option break_C in the compiled file'
  403.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  404.             SAY 'TEMPLATE :    'item' [BOOL]'
  405.         END;
  406.  
  407.         WHEN (item = "SETSIG_BRKD") THEN do
  408.             SAY 'When set, will add the interrupt option break_D in the compiled file'
  409.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  410.             SAY 'TEMPLATE :    'item' [BOOL]'
  411.         END;
  412.  
  413.         WHEN (item = "SETSIG_BRKE") THEN do
  414.             SAY 'When set, will add the interrupt option break_E in the compiled file'
  415.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  416.             SAY 'TEMPLATE :    'item' [BOOL]'
  417.         END;
  418.  
  419.         WHEN (item = "SETSIG_BRKF") THEN do
  420.             SAY 'When set, will add the interrupt option break_F in the compiled file'
  421.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  422.             SAY 'TEMPLATE :    'item' [BOOL]'
  423.         END;
  424.  
  425.         WHEN (item = "SETSIG_ERROR") THEN do
  426.             SAY 'When set, will add the interrupt option erorr in the compiled file'
  427.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  428.             SAY 'TEMPLATE :    'item' [BOOL]'
  429.         END;
  430.  
  431.         WHEN (item = "SETSIG_HALT") THEN do
  432.             SAY 'When set, will add the interrupt option halt in the compiled file'
  433.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  434.             SAY 'TEMPLATE :    'item' [BOOL]'
  435.         END;
  436.  
  437.         WHEN (item = "SETSIG_IOERR") THEN do
  438.             SAY 'When set, will add the interrupt option ioerr in the compiled file'
  439.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  440.             SAY 'TEMPLATE :    'item' [BOOL]'
  441.         END;
  442.  
  443.         WHEN (item = "SETSIG_SYNTAX") THEN do
  444.             SAY 'When set, will add the interrupt option syntax in the compiled file'
  445.             SAY 'If there is NO argument, it is assumed to be TRUE.'
  446.             SAY 'TEMPLATE :    'item' [BOOL]'
  447.         END;
  448.  
  449.         WHEN (item = "CLOSETRACEWINDOW") THEN do
  450.             SAY item' will close the trace requestor, but is only of use OUTSIDE'
  451.             SAY 'the script that called GETTRACE as the script then waits for the'
  452.             SAY 'trace requestor to close before continuing.'
  453.             SAY 'TEMPLATE :    'item' '
  454.         END;
  455.  
  456.         WHEN (item = "RESETTRACE") THEN do
  457.             SAY item' will clear the trace options, i.e. ALL REMOVED'
  458.             SAY 'TEMPLATE :    'item' '
  459.         END;
  460.  
  461.         WHEN (item = "CANCELTRACE") THEN do
  462.             SAY item' will return the argument values to those that were SNAPPED'
  463.             SAY 'using the command SNAPTRACE, If the requestor was opened by another'
  464.             SAY 'script, The values in use prior to the requestor will be used'
  465.             SAY 'TEMPLATE :    'item' '
  466.         END;
  467.  
  468.         WHEN (item = "CLOSEINTERRUPTSWINDOW") THEN do
  469.             SAY 'This will close the interrupts requestor, but is only of use OUTSIDE'
  470.             SAY 'the script that called GETINTERRUPTS as the script then waits for the'
  471.             SAY 'trace requestor to close before continuing.'
  472.             SAY 'TEMPLATE :    'item' '
  473.         END;
  474.  
  475.         WHEN (item = "RESETINTERRUPTS") THEN do
  476.             SAY item' will clear the interrupt options, i.e. ALL REMOVED'
  477.             SAY 'TEMPLATE :    'item' '
  478.         END;
  479.  
  480.         WHEN (item = "CANCELINTERRUPT") THEN do
  481.             SAY item' will return the argument values to those that were SNAPPED'
  482.             SAY 'using the command SNAPINTERRUPT, If the requestor was opened by another'
  483.             SAY 'script, The values in use prior to the requestor will be used'
  484.             SAY 'TEMPLATE :    'item' '
  485.         END;
  486.  
  487.         WHEN (item = "SNAPARGS") THEN do
  488.             SAY item' will snapshot the current state of argument options for use'
  489.             SAY 'as a backup.( restored with CANCELARGS )'
  490.             SAY 'TEMPLATE :    'item' '
  491.         END;
  492.  
  493.         WHEN (item = "SNAPTRACE") THEN do
  494.             SAY item' will snapshot the current state of trace options for use'
  495.             SAY 'as a backup.( restored with CANCELTRACE )'
  496.             SAY 'TEMPLATE :    'item' '
  497.         END;
  498.  
  499.         WHEN (item = "SNAPINTERRUPTS") THEN do
  500.             SAY item' will snapshot the current state of interrupt options for'
  501.             SAY 'use as a backup.( restored with CANCELINTERRUPTS )'
  502.             SAY 'TEMPLATE :    'item' '
  503.         END;
  504.  
  505.         OTHERWISE do
  506.             SAY item' NOT RECOGNISED AS AN ARCO COMMAND!'
  507.         END;
  508.  
  509.     END
  510. RETURN
  511.